package cn.harmonyoslearn.navrouter.models;

import cn.harmonyoslearn.navrouter.datas.JsonValue;
import cn.harmonyoslearn.navrouter.datas.NavrouterInfo;
import cn.harmonyoslearn.navrouter.utils.FileUtil;
import cn.harmonyoslearn.navrouter.utils.LogUtil;

public class NavrouterInfoModel {
    private static final String name = "navrouter-info.json";

    public static NavrouterInfo getNavrouterInfoMap(String basePath) {
        String content = FileUtil.readFileContent(basePath + "/" + name);
        JsonValue value = new JsonValue(content);
        String navNamesPath = value.getString("navNamesPath", "");
        Boolean automaticDeletion = value.getBoolean("automaticDeletion", false);
        String model = value.getString("model", "DEFAULT");
        LogUtil.i("NavrouterInfoModel", "getNavrouterInfoMap: " + navNamesPath + " " + automaticDeletion + " " + model);
        return new NavrouterInfo(navNamesPath, automaticDeletion, model);
    }
}
